#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

class segment_tree {
	vector<char> seq;
	vector<int> len;
	vector<int> pre;
	vector<int> suf;

	void up(int i, int l, int r)
	{
		int mid = (l + r) >> 1;
		len[i] = max({ len[i << 1], len[i << 1 | 1], seq[mid] == seq[mid + 1] ? 0 : suf[i << 1] + pre[i << 1 | 1] });
		pre[i] = len[i << 1] < mid - l + 1 ? pre[i << 1] : seq[mid] == seq[mid + 1] ? pre[i << 1] : pre[i << 1] + pre[i << 1 | 1];
		suf[i] = len[i << 1 | 1] < r - mid ? suf[i << 1 | 1] : seq[mid] == seq[mid + 1] ? suf[i << 1 | 1] : suf[i << 1 | 1] + suf[i << 1];
	}

	void build(int l, int r, int i)
	{
		if (l == r) {
			len[i] = pre[i] = suf[i] = 1;
		} else {
			int mid = (l + r) >> 1;
			build(l, mid, i << 1);
			build(mid + 1, r, i << 1 | 1);
			up(i, l, r);
		}
	}

    public:
	segment_tree(int n) : seq(n + 1, 'L'), len(n << 2, 0), pre(n << 2, 0), suf(n << 2, 0)
	{
		build(1, n, 1);
	}

	void update(int x, int l, int r, int i)
	{
		if (l == r) {
			seq[x] = seq[x] == 'L' ? 'R' : 'L';
		} else {
			int mid = (l + r) >> 1;
			if (x <= mid) {
				update(x, l, mid, i << 1);
			} else {
				update(x, mid + 1, r, i << 1 | 1);
			}
			up(i, l, r);
		}
	}

	int query()
	{
		return len[1];
	}
};

int main()
{
	int n, q;
	cin >> n >> q;
	segment_tree sgt(n);
	for (int i = 0, x; i < q; i++) {
		cin >> x;
		sgt.update(x, 1, n, 1);
		cout << sgt.query() << endl;
	}

	return 0;
}